import request from "./request";

/* 品类管理 */
export const findAllCategory = (params) => {
  return request({
    url: `/category/findAll`,
    method: 'get',
    params,
  })
}

export const getCategoryPage = (params, pageNum, pageSize) => {
  return request({
    url: `/category/page/${pageNum}/${pageSize}`,
    method: 'get',
    params,
  })
}

export const saveCategory = (data) => {
  return request({
    url: `/category/save`,
    method: 'post',
    data,
  })
}

export const delCategory = (id) => {
  return request({
    url: `/category/del/${id}`,
    method: 'delete',
  })
}

/* 进出库记录管理 */
export const addInoutinventory = (data) => {
  return request({
    url: `/inoutinventory/add`,
    method: 'post',
    data,
  })
}

export const delInoutinventory = (id) => {
  return request({
    url: `/inoutinventory/del/${id}`,
    method: 'delete',
  })
}

//进出库管理
export const exportInoutinventory = (params) => {
  return request({
    url: `/inoutinventory/inoutexport`,
    method: 'get',
    params
  })
}

//进出库管理
export const exportInoutinventoryPrice = (params) => {
  return request({
    url: `/inoutinventory/inoutpriceexport`,
    method: 'get',
    params
  })
}

//进出库管理
export const exportInoutinventorySel = (params) => {
  return request({
    url: `/inoutinventory/inoutselexport`,
    method: 'get',
    params
  })
}

export const importInoutinventory = (data) => {
  return request({
    url: `/inoutinventory/import`,
    method: 'post',
    data
  })
}

export const getInoutinventoryPage = (params, pageNum, pageSize) => {
  return request({
    url: `/inoutinventory/page/${pageNum}/${pageSize}`,
    method: 'get',
    params
  })
}

export const updateInoutinventory = (data) => {
  return request({
    url: `/inoutinventory/update`,
    method: 'post',
    data
  })
}

/* 库存管理 */

export const exportInoutory = (params) => {
  return request({
    url: `/inventory/export`,
    method: 'get',
    params
  })
}

export const getinventoryPage = (params, pageNum, pageSize) => {
  return request({
    url: `/inventory/page/${pageNum}/${pageSize}`,
    method: 'get',
    params
  })
}


/**供应商管理 */
export const getvendorPage = (data, pageNum, pageSize) => {
  return request({
    url: `/vendor/page/${pageNum}/${pageSize}`,
    method: 'post',
    data
  })
}

export const addVendor = (data) => {
  return request({
    url: `/vendor/add`,
    method: 'post',
    data
  })
}

export const updateVendor = (data) => {
  return request({
    url: `/vendor/update`,
    method: 'post',
    data
  })
}

export const deleVendor = (id) => {
  return request({
    url: `/vendor/del/${id}`,
    method: 'delete'
  })
}

export const findAllVendor = (params) => {
  return request({
    url: `/vendor/findAll`,
    method: 'get',
    params
  })
}

/**仓库管理 */
export const getwarehousePage = (data, pageNum, pageSize) => {
  return request({
    url: `/warehouse/page/${pageNum}/${pageSize}`,
    method: 'post',
    data
  })
}

export const addWarehouse = (data) => {
  return request({
    url: `/warehouse/add`,
    method: 'post',
    data
  })
}

export const updateWarehouse = (data) => {
  return request({
    url: `/warehouse/update`,
    method: 'post',
    data
  })
}

export const delWarehouse = (id) => {
  return request({
    url: `/warehouse/del/${id}`,
    method: 'delete'
  })
}

export const findAllWarehouse = (params) => {
  return request({
    url: `/warehouse/findAll`,
    method: 'get',
    params
  })
}
/**目录管理 */
export const getLevelFirst = (params) => {
  return request({
    url: `/level/levelFirst`,
    method: 'get',
    params
  })
}

export const addLevel = (params) => {
  return request({
    url: `/level/add`,
    method: 'post',
    params
  })
}

export const searchLevel = (params) => {
  return request({
    url: `/level/tree`,
    method: 'get',
    params
  })
}

export const updateLevel = (params) => {
  return request({
    url: `/level/update`,
    method: 'post',
    params
  })
}

export const delLevel = (id) => {
  return request({
    url: `/level/del/${id}`,
    method: 'delete',
  })
}

//用户管理
export const getUser = (params, pageNum, pageSize) => {
  return request({
    url: `/user/page/${pageNum}/${pageSize}`,
    method: 'get',
    params
  })
}

export const saveUser = (data) => {
  return request({
    url: `/user/save`,
    method: 'post',
    data,
  })
}

export const savePassword = (data, id) => {
  return request({
    url: `/user/password/${id}`,
    method: 'post',
    data,
  })
}

export const delUser = (id) => {
  return request({
    url: `/user/delete/${id}`,
    method: 'delete',
  })
}
